Movement track recording method and apparatus

ABSTRACT

A movement track recording method and an apparatus used for movement track recording, and relate to the communications field, where power consumption of a terminal can be reduced without affecting track recording precision. The method includes determining a positioning trigger condition according to positioning precision, positioning a terminal when the positioning trigger condition is met, and recording a location of the terminal.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.16/074,677, filed on Aug. 1, 2018, which is a National Stage ofInternational Patent Application No. PCT/CN2016/073153 filed on Feb. 2,2016. The entire contents of both of the aforementioned applications arehereby incorporated by reference in their entireties.

TECHNICAL FIELD

The present invention relates to the communications field, and inparticular, to a movement track recording method and an apparatus.

BACKGROUND

Currently, with progress of science and technology and an increasingdemand of people for a positioning function, the positioning functionhas become a necessary function of an intelligent terminal. More usersrecord movement tracks based on the positioning function. A movementtrack recording function may be used to: record a movement track of auser, and display the movement track on a map for the user, so as toprovide good man-machine interaction.

For a related technology, in a movement track recording process, aterminal obtains location information of the terminal once every fixedperiod, and forms a movement track depending on location informationobtained for many times. However, in this movement track recordingmanner, in order not to affect track recording precision, a relativelysmall fixed period is usually set. Consequently, power consumption ofthe terminal is increased, and a battery life of the terminal isaffected.

SUMMARY

To reduce power consumption of a terminal device without affecting trackrecording precision, the present invention provides a movement trackrecording method and an apparatus.

According to a first aspect, a movement track recording method executedby a terminal device is provided. The method includes: determining apositioning trigger condition according to positioning precision, wherethe positioning precision is precision that needs to be reached when amovement track of the terminal device is recorded, and the positioningtrigger condition is used to trigger terminal device positioning; andpositioning the terminal device when the positioning trigger conditionis met, and recording a location of the terminal device.

In this embodiment of the present invention, the positioning triggercondition is determined based on the positioning precision, so thattrack recording precision can be ensured. In addition, the positioningtrigger condition for triggering terminal device positioning is notfixed but is dynamically adjustable, so that it can be avoided thatpower consumption of the terminal device is increased because the trackis recorded by using a relatively small fixed period. In this way, thepower consumption of the terminal device is reduced without affectingthe track recording precision.

With reference to the first aspect, in a first possible implementation,the present invention is applied to an outdoor moving scenario; andcorrespondingly, the determining a positioning trigger conditionaccording to positioning precision may include: determining thepositioning trigger condition according to the positioning precisionwhen the terminal device is located in an outdoor moving scenario.

In the outdoor moving scenario, the terminal device has a relativelylarge movement track, and a movement track is more intuitively recorded.Therefore, movement track recording is preferably used in the outdoormoving scenario. Certainly, within the scope of the present invention,the movement track recording may also be used in a scenario such as anindoor moving scenario.

With reference to the first possible implementation of the first aspect,in a second possible implementation, before the determining apositioning trigger condition according to positioning precision, themethod may further include: first determining a movement status and alocation environment of the terminal device, where the movement statusincludes a still state and a moving state, and the location environmentincludes an indoor environment and an outdoor environment. In thisembodiment of the present invention, the movement status and thelocation environment of the terminal device are first determined beforethe positioning trigger condition is determined. In this way, theterminal device can be positioned in different positioning mannersaccording to different movement statuses and location environments. Forexample, GPS positioning is used for outdoor positioning, and WiFipositioning or cell identity positioning is used for indoor positioning.

With reference to any one of the foregoing possible implementations ofthe first aspect, in a third possible implementation, the positioningtrigger condition is a positioning time interval, and the positioningtime interval is dynamically adjustable. In an existing movement trackrecording manner, the positioning time interval is fixed and usuallyfixed at one second, and consequently, relatively large powerconsumption is caused. However, in this embodiment of the presentinvention, the positioning time interval is dynamically adjustable, sothat the positioning time interval is dynamically adjustable accordingto the positioning precision, so as to reduce the power consumption ofthe terminal device.

With reference to the third possible implementation of the first aspect,in a fourth possible implementation, when the positioning triggercondition is the positioning time interval, the determining apositioning trigger condition according to positioning precision may bespecifically: when the terminal device moves, determining, according tothe positioning precision and a current moving speed of the terminaldevice, a positioning time interval for a next time of positioning; andcorrespondingly, the positioning the terminal device when thepositioning trigger condition is met, and recording location informationof the terminal device may be specifically: starting timing, positioningthe terminal device when the timing reaches the positioning timeinterval for the next time of positioning, and recording a currentlocation of the terminal device.

Both the positioning precision and the current moving speed areconsidered when the positioning time interval is being determined, sothat the power consumption of the terminal device can be reduced whileensuring the positioning precision. When the current moving speed of theterminal device is high, a relatively small positioning time intervalmay be set for the next time of positioning. However, when the currentmoving speed of the terminal device becomes lower, the next positioningtime interval may be increased for the next time of positioning. Thatis, a higher speed of the terminal device indicates a smallerpositioning time interval for the next time of positioning, and a lowerspeed of the terminal device indicates a larger positioning timeinterval. In this way, the positioning time interval is dynamicallyadjusted, so as to reduce the power consumption of the terminal devicewhile ensuring the positioning precision.

With reference to the fourth possible implementation of the firstaspect, in a fifth possible implementation, the determining, accordingto the positioning precision and a current moving speed of the terminaldevice, a positioning time interval for a next time of positioningincludes:

T _(i) =D/V _(i), where

i≥1, i is a positive integer, T_(i) is a positioning time intervalbetween an i^(th) time of positioning and an (i+1)^(th) time ofpositioning, D is the positioning precision, and V_(i) is a moving speedof the terminal device during the i^(th) time of positioning.

With reference to the fifth possible implementation of the first aspect,in a sixth possible implementation, the movement track recording methodmay further include: setting a time interval threshold T₀; andcorrespondingly, the determining, according to the positioning precisionand a current moving speed of the terminal device, a positioning timeinterval for a next time of positioning may be specifically: whenT_(i)≤T₀, selecting T_(i) as the positioning time interval between thei^(th) time of positioning and the (i+1)^(th) time of positioning; orwhen T_(i)>T₀, selecting T₀ as the positioning time interval between thei^(th) time of positioning and the (i+1)^(th) time of positioning.

In this embodiment of the present invention, a smaller one of T_(i) andthe time interval threshold T₀ is selected as the positioning timeinterval between the i^(th) time of positioning and the (i+1)^(th) timeof positioning, so that a recording deviation caused by a relativelylarge time interval T_(i) can be avoided, and a proper value of thepositioning time interval can be ensured.

With reference to any one possible implementation of the first aspect,in a seventh possible implementation, the positioning trigger conditionis a geo-fence boundary, and the geo-fence boundary is dynamicallyadjustable.

With reference to the seventh possible implementation of the firstaspect, in an eighth possible implementation, when the positioningtrigger condition is the geo-fence boundary, the determining apositioning trigger condition according to positioning precision may bespecifically: setting, by using a current location of the terminaldevice as a center and using the positioning precision as a radius, ageo-fence boundary for a next time of positioning; and correspondingly,the positioning the terminal device when the positioning triggercondition is met, and recording location information of the terminaldevice may be specifically: positioning the terminal device once theterminal device moves to the geo-fence boundary, and recording a currentlocation of the terminal device.

The geo-fence boundary is used as the positioning trigger condition, sothat the geo-fence boundary can be dynamically set when the location ofthe terminal device changes, and the location of the terminal device isobtained once only when the terminal device reaches the geo-fenceboundary. In this way, an accurate movement track record can beobtained, so that the location record always exists. In addition, thepower consumption of the terminal device can be reduced.

With reference to any one possible implementation of the first aspect,in a ninth possible implementation, before the determining a positioningtrigger condition according to positioning precision, the method mayfurther include: recording an initial location of the terminal device,where the initial location may be used as a start point of the movementtrack, to instruct to start recording the movement track.

According to the movement track recording method and the apparatus thatare provided in the embodiments of the present invention, thepositioning trigger condition is determined based on the positioningprecision, so that the track recording precision can be ensured. Inaddition, the positioning trigger condition for triggering terminaldevice positioning is not fixed but is dynamically adjustable, so thatit can be avoided that the power consumption of the terminal device isincreased because the track is recorded by using a relatively smallfixed period. In this way, the power consumption of the terminal deviceis reduced without affecting the track recording precision.

BRIEF DESCRIPTION OF DRAWINGS

To describe the technical solutions in the embodiments of the presentinvention more clearly, the following briefly describes the accompanyingdrawings required for describing the embodiments. Apparently, theaccompanying drawings in the following description show merely someembodiments of the present invention, and a person of ordinary skill inthe art may still derive other drawings from these accompanying drawingswithout creative efforts.

FIG. 1A is a schematic structural diagram of a terminal device accordingto an embodiment of the present invention;

FIG. 1B is a flowchart of a movement track recording method according toan embodiment of the present invention;

FIG. 2A and FIG. 2B are a flowchart of a movement track recording methodaccording to an embodiment of the present invention;

FIG. 3 is a flowchart of a movement track recording method in an outdoormoving scenario according to an embodiment of the present invention; and

FIG. 4 is a flowchart of another movement track recording method in anoutdoor moving scenario according to an embodiment of the presentinvention.

DESCRIPTION OF EMBODIMENTS

To make the objectives, technical solutions, and advantages of thepresent invention clearer, the following further describes theembodiments of the present invention in detail with reference to theaccompanying drawings.

The embodiments of the present invention provide a movement trackrecording method, and the method may be performed by a terminal device.The terminal device may also be referred to as user equipment (UserEquipment, “UE” for short), a mobile station (Mobile Station, “MS” forshort), a mobile terminal (Mobile Terminal), or the like. The terminaldevice may communicate with one or more core networks by using a radioaccess network (Radio Access Network, “RAN” for short). For example, theterminal device may be a mobile phone (also referred to as a “cellular”phone), a computer with a mobile terminal, or the like. For example, theterminal device may be a portable, pocket-sized, handheld, computerbuilt-in, or in-vehicle mobile apparatus that may exchange voice and/ordata with the radio access network.

During movement track recording, geographical location information ofthe terminal device needs to be first obtained. In the embodiments ofthe present invention, the geographical location information of theterminal may be obtained by using a GPS (Global Positioning System,Global Positioning System) positioning technology, a WiFi positioningtechnology, a base station positioning technology, or anotherpositioning technology. This is not limited in the embodiments of thepresent invention. The GPS depends on a GPS navigation satellite toimplement positioning. For the WiFi positioning, a WiFi hardware modulecollects information about an access point (Access Point, AP) by meansof scanning, sends the information to a positioning server, and receiveslocation information from the positioning server, so as to implementpositioning. Similar to the WiFi positioning, for the base stationpositioning, a 2G/3G/4G hardware module sends received base stationinformation to a positioning server, the positioning server completespositioning, and the 2G/3G/4G hardware module receives locationinformation sent by the positioning server. Alternatively, the terminalmay implement positioning by using an inertial navigation technology,that is, obtain speed information of the terminal at each moment in amoving process by using an acceleration sensor and a gyroscope of theterminal, and calculate a current location of the terminal when knowinga start moving point. Because a person skilled in the art is ratherfamiliar with various positioning technologies for determining aterminal location, details are not described herein.

FIG. 1A shows a terminal device according to an example embodiment ofthe present invention. The terminal device 100 is typically a devicesuch as a portable terminal, a mobile phone, a mobile pad, a mediaplayer, a tablet computer, a handheld computer, or a personal digitalassistant (PDA). The terminal device 100 may have a combination of twoor more functions of these devices.

The terminal device 100 may include a memory 110, a processor 120, acommunications unit 130, an external port 140, a positioning component150, and a sensor component 160. Multiple memories 110 and multipleexternal ports 140 may be used.

The processor 120 herein may include a memory controller, amicroprocessor (a central processing unit CPU), and the like. One ormore processors may be configured herein to perform various operations.The communications unit 430 may include a baseband processor 432 and aradio frequency (RF) IC unit 431.

The configured elements communicate with each other by using one or morecommunications buses or signal cables (not shown). For example, theconfigured elements may be implemented by hardware such as one or moreICs, or by software that is loaded into the processor for execution, orby a combination of hardware and software.

The terminal device 100 in FIG. 1A is an example for the purpose ofdescription, and a person skilled in the art may implement variousdifferent configurations in the appended claims within the spirit andscope of the present invention. The terminal device 100 may include moreor fewer parts than those shown in the figure. For example, the terminaldevice 100 may not include the external port 140. Configuration of theterminal device 100 may be different from that shown in FIG. 1A.

The following describes the configured elements of the terminal device100.

For example, the memory 110 preferably includes a random access memory,a nonvolatile memory including a flash memory, a read-only memory (ROM),an electrically erasable programmable ROM (EEPROM), a magnetic diskstorage, a compact disc ROM (CD-ROM), a digital versatile disc (DVD) oranother optical storage, a cassette, and/or the like. Alternatively, thememory 110 may have a combination of some or all of these recordingmedia. Multiple memories may be equipped.

The memory 110 may store software. The software includes various typesof software used to process data sending/receiving by using the RF ICunit 431 or the external port 440, various types of software used tocontrol an inertial navigation system (INS) according to a location andsatellite information of the Global Navigation Satellite System (GNSS),operating system software, application software, and the like.

The external port 140 is, for example, but is not limited to a universalserial bus (USB) port or a FireWire port. The external port 140 isconfigured to directly connect the terminal device 100 and anotherelectronic device, or indirectly connect the terminal device 100 andanother electronic device by using a network (such as an Ethernet, theInternet, an intranet, and a wireless LAN).

The processor executes multiple functions of the terminal device 100 byexecuting multiple software programs, and processes and controls voicecommunication and data communication. In addition to these typicalfunctions, the processor may further execute a specific software module(an instruction set) stored in the memory 410, and execute variousspecific functions corresponding to the module.

In addition, the communications unit 130 may include the RF IC unit 131and the baseband processor 132. The RF IC unit 131 sends/receives aradio wave. The RF IC unit 131 converts, into a radio wave, a basebandsignal fed from the baseband processor 132, and sends the radio wave byusing an antenna. The RF IC unit 131 converts a radio wave received byusing an antenna, and provides a converted radio wave to the basebandprocessor 132. The RF IC unit 131 may include an RF transceiver, anamplifier, a tuner, an oscillator, a digital signal processor, acoder/decoder (CODEC) chip set, and a subscriber identity module (SIM)card. These components are not shown in the figure.

In addition, the RF IC unit 131 communicates with a communicationsnetwork and another communications device by using a radio wave. Forexample, the RF IC unit 131 may communicate with a wireless network,such as the Internet, an intranet, a network, a cellular telephonenetwork, a wireless LAN, or a wireless metropolitan area network (MAN).The RF IC unit 131 may communicate with another electronic device bymeans of wireless communication.

The wireless communication refers to, for example, but is not limited toa single protocol or any combination of the following protocols: TimeDivision Multiple Access (TDMA), Global System for Mobile Communications(GSM), Enhanced Data for GSM Environment (EDGE), Code Division MultipleAccess (CDMA), Wideband Code Division Multiple Access (W-CDMA),Orthogonal Frequency Division Multiple Access (OFDMA), Bluetooth, NearField Communication (NFC), infrared communications, Voice over InternetProtocol (VoIP), Wireless Fidelity (Wi-Fi), Wi-MAX, or a protocol forreceiving/sending an email or instant message or for a short messageservice (SMS).

In this example embodiment, the RF IC unit 131 performs frequencyconversion on an RF signal received by using an antenna (not shown), andprovides a converted signal to the baseband processor 132. In addition,the RF IC unit 131 performs frequency conversion on a baseband signalthat is output from the baseband processor 132, and sends a convertedsignal by using an antenna. For example, in a nonrestrictive example,when performing sending according to CDMA, the baseband processor 132performs channel coding and spreading on to-be-sent data. Whenperforming receiving, the baseband processor 132 performs despreadingand channel decoding on a received signal. However, a person skilled inthe art may understand that a form of a spread spectrum for sending isnot limited in the claimed invention.

The positioning component 150 is configured to: position the terminaldevice, and provide a result to the processor. When the GPS positioningmanner is used, the positioning component 150 may include a satelliteinformation receiver, and position the terminal device by receiving aGPS satellite signal. Similarly, when the WiFi positioning manner or thebase station positioning manner is used, the positioning component 150may include hardware adaptive to the positioning manner.

The sensor component 160 detects a signal by using an inertial sensor(such as an accelerometer, a gyroscope, and an altimeter) and anadditional sensor (such as a geomagnetic sensor), to obtain informationabout an acceleration, a speed, and a direction (sensor data for short);and provides a result to the processor 422.

FIG. 1B is a flowchart of a movement track recording method according toan embodiment of the present invention. Referring to FIG. 1B, thefollowing describes the track recording method provided in thisembodiment of the present invention. The method may include thefollowing steps.

11. Determine a positioning trigger condition according to positioningprecision.

The positioning precision is precision that needs to be reached when amovement track of a terminal device is recorded. A value of thepositioning precision may be set by a vendor of the terminal device andmay be selected by a user of the terminal device; or may be directly setby a vendor of the terminal device but cannot be selected by a user ofthe terminal device. For example, the positioning precision may be setto 10 meters, 20 meters, or the like.

The positioning trigger condition is used to trigger terminal devicepositioning. In this embodiment of the present invention, thepositioning trigger condition may be a positioning time interval, or maybe a geo-fence boundary or the like.

12. Position a terminal device when the positioning trigger condition ismet, and record a location of the terminal device.

Before step 11, an initial location of the terminal device may be firstdetermined, and the initial location of the terminal device may berecorded. In this way, the terminal device can be subsequentlypositioned according to the positioning trigger condition, andsubsequent locations of the terminal device are recorded to form amovement track for the user to view and use.

According to the movement track recording method provided in thisembodiment of the present invention, the terminal device is positionedwhen the positioning trigger condition is met, and the location of theterminal device is recorded. The positioning precision is consideredwhen the positioning trigger condition is being determined, so thatprecision in recording the movement track of the terminal device cannotbe affected. In addition, the variable positioning trigger conditioninstead of a relatively small fixed period is used as the terminaldevice positioning condition, so that power consumption of the terminaldevice can be reduced.

In this embodiment of the present invention, before the determining apositioning trigger condition according to positioning precision, amovement status and a location environment of the terminal device may befurther determined. The movement status includes a still state and amoving state, and the location environment includes an indoorenvironment and an outdoor environment. In this way, in this embodimentof the present invention, there may be four specific applicationscenarios: an outdoor moving scenario, an indoor moving scenario, anoutdoor still scenario, and an indoor still scenario.

In this embodiment of the present invention, the still state or themoving state may be determined by using a motion sensor and/or invarious positioning manners (such as the GPS). The motion sensor mayinclude at least one of the following: an accelerometer, a gyroscope, amagnetometer, a pressure sensor, a temperature sensor, a microphone, ora heart rate detector. For example, when the location of the terminaldevice significantly changes, a previous location and a current locationare directly compared by means of positioning, to determine whether theterminal device moves. When the location of the terminal device slightlychanges, data from the motion sensor may be collected, and movementstatus information is calculated according to each piece of collecteddata. For example, if an accelerometer standard deviation is higher thana threshold A, it is assumed that a user is running. Otherwise, if anaccelerometer standard deviation is higher than a threshold B and lowerthan a threshold A, it is assumed that a user is walking; otherwise, itis assumed that a user is standing or sitting. In this way, the actiontypes of the user may be distinguished from each other.

In this embodiment of the present invention, the location environment ofthe terminal device may be determined in the following manner:determining a current location environment of the terminal deviceaccording to a quantity of GPS satellites and/or a received signalstrength indicator (RSSI) of a WiFi access point. For example, when thequantity of visible GPS satellites is not less than 4, it may bedetermined that the terminal device is located in an outdoorenvironment; or when the quantity of GPS satellites is less than 4, itis determined that the terminal device is located in an indoorenvironment; or when the quantity of GPS satellites is less than 4 andthe RSSI of the WiFi access point is less than a predetermined value, itis determined that the terminal device is located in an indoorenvironment.

The movement track recording method provided in this embodiment of thepresent invention may be applied to various scenarios. The movementtrack recording method is typically applied to an outdoor movingscenario in which the terminal device is located. In the followingdescription, an example in which the movement track recording method isapplied to an outdoor moving scenario is used for description. It shouldbe noted that the movement track recording method provided in thisembodiment of the present invention may also be applied to a scenariosuch as an indoor moving scenario.

When the movement track recording method is applied to the outdoormoving scenario, the determining a positioning trigger conditionaccording to positioning precision in step 11 may include: determiningthe positioning trigger condition according to the positioning precisionwhen the terminal device is located in an outdoor moving scenario.

In this embodiment of the present invention, the positioning triggercondition may be the positioning time interval, or may be the geo-fenceboundary. The positioning time interval is adjustable when thepositioning trigger condition is the positioning time interval, and thegeo-fence boundary is also adjustable when the positioning triggercondition is the geo-fence boundary.

Specifically, in an embodiment, when the positioning trigger conditionis the positioning time interval, the determining a positioning triggercondition according to positioning precision in step 11 may include:

when the terminal device moves, determining, according to thepositioning precision and a current moving speed of the terminal device,a positioning time interval for a next time of positioning. The currentmoving speed of the terminal device may be sensed by using anaccelerometer.

The positioning a terminal device when the positioning trigger conditionis met, and recording location information of the terminal device instep 12 may include:

starting timing, positioning the terminal device when the timing reachesthe positioning time interval for the next time of positioning, andrecording a current location of the terminal device.

Optionally, the determining, according to the positioning precision anda current moving speed of the terminal device, a positioning timeinterval for a next time of positioning may be specifically:

T _(i) =D/V _(i), where

i≥1, i is a positive integer, T_(i) is a positioning time intervalbetween an i^(th) time of positioning and an (i+1)^(th) time ofpositioning, D is the positioning precision, and V_(i) is a moving speedof the terminal device during the i^(th) time of positioning.

To further ensure low power consumption of the terminal device, a timeinterval threshold T₀ may be set in this embodiment of the presentinvention. T_(i) and T₀ are compared, and a smaller one is selected fromT_(i) and T₀ as the positioning time interval, so as to ensure a smallertime interval, and avoid a movement track recording deviation caused bya relatively large T_(i).

That is, the determining, according to the positioning precision and acurrent moving speed of the terminal device, a positioning time intervalfor a next time of positioning may be specifically:

when T_(i)≤T₀, selecting T_(i) as the positioning time interval betweenthe i^(th) time of positioning and the (i+1)^(th) time of positioning;or

when T_(i)>T₀, selecting T0 as the positioning time interval between thei^(th) time of positioning and the (i+1)^(th) time of positioning.

The time interval threshold T₀ may be set according to a requirement.

In this way, a proper value of the positioning time interval between thei^(th) time of positioning and the (i+1)^(th) time of positioning can beensured, so as to reduce the power consumption of the terminal device.

In this embodiment of the present invention, the positioning timeinterval is used as the positioning trigger condition, so that thepositioning time interval can be changed when the location or a movingspeed of the terminal device changes, and the location of the terminaldevice is obtained once only after the positioning time interval isreached. In this way, an accurate movement track record can be obtained,so that the location record always exists. In addition, the powerconsumption of the terminal device can be reduced.

In another embodiment, the positioning trigger condition may be thegeo-fence boundary. In this embodiment of the present invention, ageo-fence may be defined as a fence that surrounds a designatedgeographical area, an adjacent area, a parcel delivery route, a schoolzone, or the like. For example, the geo-fence may be defined by usinglatitude and longitude coordinates associated with points along aperiphery of the geographical area. Optionally, the geo-fence may bedefined based on latitude and longitude coordinates of a center and aradius of the geographical area. The geo-fence may be in any shape,including but not limited to a circle, a square, a rectangle, anirregular shape, or the like. In addition, geo-fence areas do not needto be in a same shape or size. The geo-fence may overlap anothergeo-fence.

In this embodiment of the present invention, when the positioningtrigger condition is the geo-fence boundary, an implementation ofdetermining the positioning trigger condition according to thepositioning precision may be: setting a geo-fence boundary by using acurrent location of the terminal device as a center and using thepositioning precision as a radius. When the geo-fence boundary is beingset, the terminal device may be in the moving state, or may be in thestill state. Certainly, within the scope of the present invention, inaddition to a circular geo-fence boundary, various shapes of geo-fenceboundaries may further be set. For example, a semicircular geo-fenceboundary towards a specified direction is set by using the currentlocation as a center and using the positioning precision as a radius, ora square geo-fence boundary is set by using the current location as acenter and using a value twice the value of the positioning precision asa side length with reference to the positioning precision.

In this embodiment of the present invention, once the geo-fence boundaryis set, geographical coordinates of points on the geo-fence boundary ora location representation manner similar to the geographic coordinatesmay be stored.

In this embodiment of the present invention, when the positioningtrigger condition is the geo-fence boundary, correspondingly, thepositioning a terminal device when the positioning trigger condition ismet, and recording location information of the terminal device in step12 may be specifically: positioning the terminal device when theterminal device moves to the geo-fence boundary, and recording a currentlocation of the terminal device. In this embodiment of the presentinvention, the geo-fence boundary may be a boundary of an areadelimitated by a geo-fence. It may be considered that the positioningtrigger condition is met when the terminal device moves to the geo-fenceboundary or a distance from the terminal device to the geo-fenceboundary is less than a specified value. The specified value is a quitesmall value, such as 1 meter.

In this embodiment, terminal device positioning and movement trackrecording are triggered once the terminal device moves to a specifiedgeo-fence boundary. A geo-fencing function that the terminal deviceoriginally has may be used to check whether the geo-fence boundary istriggered. Alternatively, a current geographical coordinate location ofthe mobile terminal may be obtained and compared with a geographicalcoordinate that is of the geo-fence boundary that is stored when thegeo-fence boundary is set, to determine whether the terminal devicereaches the geo-fence boundary.

Further, the movement track recording manner that is provided in thisembodiment of the present invention and that is triggered based on thegeo-fence boundary may specifically be as follows: initially obtaining acurrent location of the terminal device by using any one of theforegoing positioning manners, that is, the initial location, andrecording the initial location. The current location may be latitude andlongitude information of the terminal device. After the initial locationof the terminal device is obtained, a geo-fence boundary, that is, afirst geo-fence boundary may be set by using the initial location of theterminal device as a center and using the positioning precision as aradius. When the terminal device moves to the first geo-fence boundary,obtaining of a current location, that is, a second location of theterminal device may be triggered, the second location may be recorded,and a second geo-fence boundary may be set by using the second locationas a center and using the positioning precision as a radius. When theterminal device moves to the second geo-fence boundary, obtaining of acurrent location, that is, a third location of the terminal device maybe triggered, the third location may be recorded, and a third geo-fenceboundary may be set by using the third location as a center and usingthe positioning precision as a radius. A subsequent process is deducedby analogy. As the terminal device moves, each time the terminal devicereaches a specified geo-fence boundary, a location of the terminaldevice is obtained and recorded, and a next geo-fence boundary is set.

Depending on a moving direction of the terminal device, two geo-fenceboundaries that are sequentially specified in a time sequence maypartially overlap or may completely overlap.

It can be learned from the foregoing description that, in thisembodiment of the present invention, the geo-fence boundary is used asthe positioning trigger condition, so that the geo-fence boundary can bedynamically set when the location of the terminal device changes, andthe location of the terminal device is obtained once only when theterminal device reaches the geo-fence boundary. In this way, an accuratemovement track record can be obtained, so that the location recordalways exists. In addition, the power consumption of the terminal devicecan be reduced.

FIG. 2A and FIG. 2B are a flowchart of a movement track recording methodaccording to an embodiment of the present invention. Referring to FIG.2A and FIG. 2B, the movement track recording method provided in thisembodiment of the present invention is performed by a terminal device,and the method may include the following steps.

21. Switch on the terminal device configured to record a movement track,and start GNSS positioning.

22. Record an initial location L₀ (X₀, Y₀) of the terminal device whenthe GNSS positioning succeeds, where the initial location may berepresented by using latitude and longitude information, and L₀ (X₀, Y₀)represents the initial location of the terminal device during themovement track recording.

23. Determine whether the terminal device is located in an outdoorscenario. If the terminal device is located in the outdoor scenario,step 24 is performed; or if the terminal device is located in an indoorscenario, step 25 is performed.

24. Perform subsequent steps 241 to 245 if it is determined that theterminal device is located in the outdoor scenario.

241. When the terminal device is located in the outdoor scenario,determine whether the terminal device is located in a moving scenario.If the terminal device is located in the moving scenario, go to step242; or if the terminal device is located in a still scenario, go tostep 244.

242. Determine that the terminal device is located in the outdoor movingscenario.

243. Record a movement track by using an algorithm corresponding to the“outdoor moving scenario”. The algorithm corresponding to the outdoormoving scenario may be either of the foregoing movement track recordingmanner that is based on the positioning time interval or the foregoingmovement track recording manner that is based on the geo-fence boundary.In the outdoor moving scenario, the location of the terminal device maybe determined by means of GPS positioning.

244. Determine that the terminal device is located in an outdoor stillscenario.

245. Record a movement track by using an algorithm corresponding to the“outdoor still scenario”. The algorithm corresponding to the outdoorstill scenario may be the foregoing movement track recording manner thatis based on the geo-fence boundary. In this case, because the terminaldevice is in a still state, the terminal device does not reach aspecified geo-fence boundary, and therefore, movement track recording isnot triggered. Movement track recording is triggered only when theterminal device is switched to a moving scenario. Certainly, thealgorithm corresponding to the outdoor still scenario may be aconventional manner of recording a movement track once every fixedperiod.

25. Perform subsequent steps 251 to 255 if it is determined that theterminal device is located in an indoor scenario.

251. When the terminal device is located in the indoor scenario,determine whether the terminal device is located in a moving scenario.If the terminal device is located in the moving scenario, go to step252; or if the terminal device is located in a still scenario, go tostep 254.

252. Determine that the terminal device is located in the indoor movingscenario.

253. Record a movement track by using an algorithm corresponding to the“indoor moving scenario”. The algorithm corresponding to the indoormoving scenario may be either of the foregoing movement track recordingmanner that is based on the positioning time interval or the foregoingmovement track recording manner that is based on the geo-fence boundary.In the indoor moving scenario, the location of the terminal device maybe determined by using the foregoing WiFi positioning or base stationpositioning.

254. Determine that the terminal device is located in an indoor stillscenario.

255. Record a movement track by using an algorithm corresponding to the“indoor still scenario”. The algorithm corresponding to the indoor stillscenario may be the foregoing movement track recording manner that isbased on the geo-fence boundary. In this case, because the terminaldevice is in a still state, the terminal device does not reach aspecified geo-fence boundary, and therefore, movement track recording isnot triggered. Movement track recording is triggered only when theterminal device is switched to a moving scenario. Certainly, thealgorithm corresponding to the indoor still scenario may be aconventional manner of recording a movement track once every fixedperiod.

26. Record a current location L_(i) (X_(i), Y_(i)) of the terminaldevice when the positioning succeeds in various scenarios, where L_(i)(X_(i), Y_(i)) may represent a current location of the terminal deviceduring an i^(th) time of movement track recording. That is, steps 23 to26 are performed each time a movement track needs to be recorded, so asto form the current location of the terminal device during the i^(th)time of movement track recording.

27. Form a movement track recording location sequence. The movementtrack recording location sequence may be stored by using a queue.

28. Use the movement track recording location sequence for an LBS(location based service, Location based service) service.

It should be noted that the steps shown in FIG. 2A and FIG. 2B are usedonly to help readers understand the various scenarios of the presentinvention and the movement track recording manners in the variousdifferent scenarios. A person skilled in the art should understand thatonce the terminal device is switched from one scenario to anotherscenario, a movement track recording manner in the another scenarioafter switching may be executed. For example, when the terminal deviceis located in the outdoor still scenario, the movement track recordingmanner that is based on the geo-fence boundary or the manner ofrecording a movement track once every fixed period may be used. However,once a sensor component detects that the terminal device is switchedfrom the outdoor still scenario to the outdoor moving scenario, themovement track recording manner that is based on the geo-fence boundaryand that is provided in the embodiments of the present invention or themovement track recording manner that is based on the positioning timeinterval and that is provided in the embodiments of the presentinvention is used.

It should be noted that the foregoing description is just an example ofthe present invention. Within the scope of the present invention, thesequence of the foregoing steps may be adjusted to form another example.For example, it may be first determined whether the terminal device islocated in a moving scenario, and it may be then determined whether theterminal device is located in an outdoor scenario.

The movement track recording method provided in this embodiment of thepresent invention may be applied to the various scenarios, and ispreferably applicable to the outdoor moving scenario and the indoormoving scenario. The following uses the outdoor moving scenario as anexample to give further explanation.

FIG. 3 is a flowchart of a movement track recording method in an outdoormoving scenario according to an embodiment of the present invention. InFIG. 3, a positioning trigger condition is a positioning time interval.Referring to FIG. 3, the movement track recording method provided inthis embodiment of the present invention may include the followingsteps.

31. Switch on a terminal device, start GNSS positioning, and determinethat the terminal device is located in an outdoor moving scenario.

32. Record location information L_(i) (X_(i), Y_(i)) and a speed V_(i)(X_(i), Y_(i)) when GPS positioning succeeds, where i is a positiveinteger, an initial value may be 1, L_(i) (X_(i), Y_(i)) is currentlatitude and longitude information, and V_(i) (X_(i), Y_(i)) is a movingspeed of the terminal device during an i^(th) time of positioning.

33. Determine a next positioning time interval T according topositioning precision D, where T=Min {T_(i), T₀} is selected.

T_(i)=D/V_(i), where T₀ is a fixed time interval threshold, T_(i) is apositioning time interval between the i^(th) time of positioning and an(i+1)^(th) time of positioning, D is the positioning precision, andV_(i) is the moving speed of the terminal device during the i^(th) timeof positioning.

34. Start GNSS positioning after the next positioning interval T isreached, and obtain location information L_(i+1) (X_(i+1), Y_(i+1)) anda moving speed V_(i+1) (X_(i+1), Y_(i+1)).

35. Record the location information to a location queue, and perform anext time of positioning.

During the next time of positioning, go back to step 33. Steps 33 to 35are repeatedly performed until a user instructs to end the movementtrack recording.

In this embodiment of the present invention, the positioning timeinterval is used as the positioning trigger condition, so that thepositioning time interval can be changed when a location or a movingspeed of the terminal device changes, and the location of the terminaldevice is obtained once only after the positioning time interval isreached. In this way, an accurate movement track record can be obtained,so that the location record always exists. In addition, powerconsumption of the terminal device can be reduced.

FIG. 4 is a flowchart of a movement track recording method in an outdoormoving scenario according to an embodiment of the present invention. InFIG. 4, a positioning trigger condition is a geo-fence boundary.Referring to FIG. 4, the movement track recording method provided inthis embodiment of the present invention may include the followingsteps:

41. Switch on a terminal device, start GNSS positioning, and determinethat the terminal device is located in an outdoor moving scenario.

42. Record location information L_(i) (X_(i), Y_(i)) when GPSpositioning succeeds, where i is a positive integer, an initial valuemay be 1, and L_(i) (X_(i), Y_(i)) is current latitude and longitudeinformation.

43. Determine a geo-fence boundary according to positioning precision Dand by using L_(i) (X_(i), Y_(i)) as a center and using the positioningprecision D as a radius.

44. Start a geo-fence mode for determining, trigger GNSS positioningwhen a user reaches the geo-fence boundary, and obtain locationinformation L_(i+1) (X_(i+1), Y_(i+1)).

45. Record the location information to a location queue, and perform anext time of positioning.

During the next time of positioning, go back to step 43. Steps 43 to 45are repeatedly performed until a user instructs to end the movementtrack recording.

In this embodiment of the present invention, the geo-fence boundary isused as the positioning trigger condition, so that the geo-fenceboundary can be dynamically set when a location of the terminal devicechanges, and the location of the terminal device is obtained once onlywhen the terminal device reaches the geo-fence boundary. In this way, anaccurate movement track record can be obtained, so that the locationrecord always exists. In addition, power consumption of the terminaldevice can be reduced.

Based on a same concept, an embodiment of the present invention furtherprovides a terminal device. As shown in FIG. 1A, the terminal deviceprovided in this embodiment may implement the procedures in theembodiments shown in FIG. 1B, FIG. 2A and FIG. 2B, FIG. 3, and FIG. 4 inthe present invention. The terminal device includes a processor 120 anda positioning component 150.

The processor 120 is configured to determine a positioning triggercondition according to positioning precision. The positioning triggercondition is not fixed.

The positioning component 150 is configured to position the terminalwhen the positioning trigger condition is met.

The processor 120 is further configured to record a location of theterminal.

Optionally, the processor 120 is specifically configured to:

determine the positioning trigger condition according to the positioningprecision when the terminal is located in an outdoor moving scenario orin an indoor moving scenario.

Optionally, before determining the positioning trigger conditionaccording to the positioning precision, the processor 150 is furtherconfigured to:

determine a movement status and a location environment of the terminal,where the movement status includes a still state and a moving state, andthe location environment includes an indoor environment and an outdoorenvironment.

Optionally, the positioning trigger condition is a positioning timeinterval, and the positioning time interval is dynamically adjustable.

Optionally, the processor 120 is specifically configured to:

when the terminal moves, determine, according to the positioningprecision and a current moving speed of the terminal, a positioning timeinterval for a next time of positioning.

The positioning component 150 is specifically configured to position theterminal when timing reaches the positioning time interval for the nexttime of positioning.

The processor 120 is specifically configured to record a currentlocation of the terminal.

Optionally, the processor is specifically configured to:

determine that a positioning time interval between an i^(th) time ofpositioning and an (i+1)^(th) time of positioning is T_(i)=D/V_(i),where

i≥1, i is a positive integer, T_(i) is the positioning time intervalbetween the i^(th) time of positioning and the (i+1)^(th) time ofpositioning, D is the positioning precision, and V_(i) is a moving speedof the terminal during the i^(th) time of positioning.

Optionally, the processor 120 is further configured to set a timeinterval threshold T₀; and

when T_(i)≤T₀, select T_(i) as the positioning time interval between thei^(th) time of positioning and the (i+1)^(th) time of positioning; or

when T_(i)>T₀, select T₀ as the positioning time interval between thei^(th) time of positioning and the (i+1)^(th) time of positioning.

Optionally, the positioning trigger condition is a geo-fence boundary,and the geo-fence boundary is dynamically adjustable.

Optionally, the processor 120 is specifically configured to:

set, by using a current location of the terminal as a center and usingthe positioning precision as a radius, a geo-fence boundary for a nexttime of positioning.

The positioning component 150 is configured to position the terminalonce the terminal moves to the geo-fence boundary.

The processor 120 is specifically configured to record a currentlocation of the terminal.

Optionally, before determining the positioning trigger conditionaccording to the positioning precision, the processor 120 is furtherconfigured to:

record an initial location of the terminal device.

According to the terminal device provided in this embodiment of thepresent invention, the terminal device is positioned when thepositioning trigger condition is met, and the location of the terminaldevice is recorded. The positioning precision is considered when thepositioning trigger condition is being determined, so that precision inrecording a movement track of the terminal device cannot be affected. Inaddition, the variable positioning trigger condition instead of arelatively small fixed period is used as the terminal device positioningcondition, so that power consumption of the terminal device can bereduced.

Optionally, an embodiment of the present invention further provides amovement track recording apparatus. The apparatus includes a memory anda processor, and the memory stores a computer instruction. Whenexecuting the computer instruction, the processor executes the movementtrack recording method provided in the embodiments of the presentinvention. The movement track recording apparatus may be the foregoingterminal device.

Optionally, an embodiment of the present invention further provides anon-temporary storage medium. The non-temporary storage medium isconfigured to store a program designed for the movement track recordingapparatus to execute the foregoing method. The program includes thecomputer software instruction used by the foregoing movement trackrecording apparatus.

It should be noted that for the foregoing movement track recordingapparatus provided in the foregoing embodiment, only the division of theforegoing function modules is used as an example for description. Inactual application, the foregoing functions can be allocated accordingto a requirement to different function modules for implementation, thatis, an inner structure of the apparatus is divided into differentfunction modules to implement all or some of the foregoing functions. Inaddition, the movement track recording apparatus provided in theforegoing embodiment and the movement track recording method pertain tothe same concept. For a specific implementation process, refer to themethod embodiments, and details are not described herein again.

A person of ordinary skill in the art may understand that all or some ofthe steps of the embodiments may be implemented by hardware or a programinstructing related hardware. The program may be stored in acomputer-readable storage medium. The storage medium may include aread-only memory, a magnetic disk, an optical disc, or the like.

The foregoing descriptions are merely examples of embodiments of thepresent invention, but are not intended to limit the present invention.Any modification, equivalent replacement, and improvement made withinthe scope of the present invention shall fall within the protectionscope of the present invention.

What is claimed is:
 1. A movement track recording method, wherein themethod comprises: determining a positioning trigger condition accordingto positioning precision; and positioning a terminal device when thepositioning trigger condition is met, and recording a location of theterminal device.